<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 打印四方形
    // 用双循环 外层控制行,
    // 内控列
    function fn1() {
      // 控制行数
      let row = "";
      for (let i = 0; i < 6; i++) {        
        for (let j = 0; j < 6; j++) {
          row = row+"*";
        }
        // 一行打完6个才换行
        row+="\n"
      }
      console.log(row)
    }
    fn1()
    // 打印直角三角形
    let fn2 = function () {
      let row = "";
      // 5行
      for (let i = 1; i <= 10; i++) {
        // 列数 = 2*行-1
        for (let j = 1; j <=i; j++) {
          row = row+"*";
        }
        // 一行打完6个才换行
        row+="\n"
      }
      console.log(row)
    }
    fn2()


    
  </script>
</body>
</html>